<link rel="stylesheet" href="/static/admin/hui/static/h-ui/css/H-ui.css">
<style>
	.mt{margin-top: 15px;}
</style>
<section id="edit" style="padding: 15px;">

	<div>
		<label class="label label-default radius">权限名称</label>
		<input type="text" v-model="one.name" class="input-text" placeholder="请输入更改后的权限名称">
	</div>

	<div class="mt">
		<label class="label label-default radius">权限标签</label>
		<input type="text" v-model="one.tags" class="input-text" placeholder="请输入更改后的权限标签">
	</div>

	<div class="mt">
		<label class="label label-default radius">权限路径</label>
		<input type="text" v-model="one.url" class="input-text" placeholder="请输入更改后的权限路径">
	</div>

</section>
<script src="/static/admin/js/jquery.min.js"></script>
<script src="/static/admin/layer/layer.js"></script>
<script src="/static/admin/js/h.js"></script>
<script src="/static/admin/eleme/vue.js"></script>

<script>
var vm = new Vue({
	el: '#edit',
	data: {
		one: {tags:'',name:'',url:'', pid: 0, category: {{ ct }}},
	},
	mounted: function(){
		if ({{tj}}) {
			this.one.pid = {{one|safe}}.id;
		} else {
			this.one = {{one|safe}};
		}
	}
})

function call_submit(index){
	if (/^\s*$/.test(vm.one.name)) {
		layer.msg('权限名称不正确',{icon:2, time:2000});
		return false;
	} else if (vm.one.tags == '') {
		layer.msg('权限标签不能为空', {icon:2, time:2000});
		return false;
	}

	H.ajax('/admin/quanxian/editor',vm.one, 'post', function(data){
		parent.layer.msg(data.data, {icon:1, time:2000});
		setTimeout(function(){
			parent.refresh()
			parent.layer.close(index);
		}, 2000)
	})
}
</script>